package com.hjj.services;

import com.hjj.beans.DictionaryType;
import com.hjj.mapper.DictionaryTypeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.UUID;

@Service
public class DictionaryTypeServicesImp implements DictionaryTypeServices{
    @Autowired
    DictionaryTypeMapper dictionaryTypeMapper;

    @Override
    public ArrayList<DictionaryType> getAll() {
        return dictionaryTypeMapper.getAll();
    }

    @Override
    public DictionaryType get(String id) {
        return dictionaryTypeMapper.get(id);
    }

    @Override
    public boolean add(DictionaryType dictionaryType) {
        // 给字典数据添加UUID
        dictionaryType.setCode(UUID.randomUUID().toString().replace("-", ""));
        return dictionaryTypeMapper.add(dictionaryType) > 0 ? true : false;
    }

    @Override
    public boolean edit(DictionaryType dictionaryType) {
        return dictionaryTypeMapper.edit(dictionaryType) > 0 ? true : false;
    }


    @Override
    public boolean del(String[] ids) {
        return dictionaryTypeMapper.del(ids) > 0 ? true : false;
    }
}
